import re

text = "hello hello world world"
pattern = r'\b(\w+)\s\w+\b'
result = re.findall(pattern, text)
print(result)

html = '<h1>标题</h1><p>段落内容1</p><p>段落内容2</p>'
# pattern = r''

text = "Python is awesome. PYTHON is powerful. python is easy to learn"
print(re.findall(r'python', text))
print(re.findall(r'python', text, re.I))
print(re.findall(r'(?i)python', text))
text = """第一行开始
第二行开始
第三行开始
结束
"""
print(re.findall(r'^第.+行', text, re.M))
print(re.findall(r'(?m)^第.+行', text))

text = """啦啦啦啦第一行开始
第二行开始
第三行开始
结束
"""
match = re.search(r'第一行.*第三行', text, re.DOTALL)
print(match.group())
text = "<div>DIV_A<div>DIV_AA</div></div><div>DIV_B</div>"
pattern = r'<div>.*</div>'
match = re.search(pattern, text)
print("贪婪的结果:",match.group())

pattern = r'<div>.*</div>'
match = re.search(pattern, text)
